/**
 * Created by shudong.msd(风骐) on 2016/4/5.
 */

var curday = new Date(2016, 3, 6);
function UTCDate() {
    return new Date(Date.UTC.apply(Date, arguments));
}
var uday = new UTCDate(2016, 3, 6);

console.log(curday.getTime());
console.log(uday.getTime());


console.log(curday.getTime() - 24 * 60 * 60 * 1000);

var day = new Date(curday.getTime() - 2 * 24 * 60 * 60 * 1000);

console.log(day.getDay());


otherPickerInput = new Date(Date.parse("".replace(/-/g, "/")));

console.log(otherPickerInput == "Invalid Date");


console.log(typeof 1);
console.log(typeof '1');
console.log(1 instanceof Object);

c = [];
for (var i = 65; i <= 91; i++) {
    c.push(String.fromCharCode(i));
}
console.log(c);

var dynamicDomPlugin = function(){};
dynamicDomPlugin.prototype = {
    source:1,
    target:2
};

a = new dynamicDomPlugin();
console.log(a.source);


var tmp = "list-group-item list-category_item selected-city"
console.log('.'+tmp.split(/ +/).join('.'));



var p = [
    {name:"kitty", age:12},
    {name:"sonny", age:9},
    {name:"jake", age:13},
    {name:"fun", age:24}
]
function down(x, y) {
    return (x.age < y.age) ? 1 : -1

}
console.log(p.sort(down));

if(p[0]['name'])console.log('aaaaaaa');
if(p[0]['ccc'])console.log('bbbbb');


var a = [];

a.push('1');
a.push('2');
//console.log(a.pop())
a.splice(0,0,'3')
console.log(a.splice(0,1));
console.log(a)

d = Date.parse('2016/01/01');
d2 = new Date(Date.parse('2016/01/01'));
console.log(d);
console.log(d2.getTime());


/*
var a = [1,2,3,4,5,6,7,8,9,10];

while(true){
    console.log(a[parseInt(a.length*Math.random())]);
}*/

console.log((new Date()).valueOf())


a = {'a':1,'b':2};
delete  a.b
console.log(a);

a = ['20160307-20160314','20160229-20160307'];

console.log(a.sort())

console.log(new Date('20160307'))

var s = '20160307-20160314';
var i = -1;
do{
    i++;
    i = s.indexOf('2',i);
    console.log(i)
}while(i!=-1);

a = new Array();
a = ['20160307','20160229'];
console.log(a.join('|'));


for( var i in null){
    console.log(i)
}


function sleep(d){
    for(var t = Date.now();Date.now() - t <= d;);
}


while(true){
    console.log('aaaaaaaaa');
    sleep(3000);
}